package de.mpii.html.table.property;

import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;

public abstract class Property {

	enum Type {
		BY_CHARACTERISTICS, BY_ENUMERATION
	};

	protected Type type;

	protected Pattern pattern;
	protected String[][] enumeration;

	protected Property(Type type) {
		this.type = type;
	}

	protected Map<String, String> getReverseMap() {
		Map<String, String> map = new HashMap<String, String>();

		if (enumeration == null)
			return null;

		String name;

		for (String[] tuple : enumeration) {
			name = tuple[0];

			for (int i = 1; i < tuple.length; i++) {
				map.put(tuple[i], name);
			}
		}

		return map;
	}

}
